# coding: utf-8
'''
Created on 27 avr. 2011

@author: shin
'''
import unittest
from business.Modele   import Modele 
from stub.Observer     import Observer

class Test(unittest.TestCase):

    def setUp(self):
        modele = Modele()
        modele.addObserver(Observer())
        modele.nouveauCombat("niveau1")
        modele.creerEquipe("Equipe1", "Equipe2")
        modele.positionneElement("Rankor", "A1")
        
        self.activite = modele._activite
        
    def tearDown(self):
        del self.activite


    def test_demandeCompetence(self):
        rankor = self.activite._elements["Rankor"]
        self.assertEqual(self.activite.demandeCompetence(
                            rankor,
                            'Mouvement'),
                         (['A2', 'A3', 'A4',
                           'B1', 'B2', 'B3',
                           'C1', 'C2', 'D1'],
                          "marque_choixPossible") )

    def test_demandeMouvement(self):
        rankor = self.activite._elements["Rankor"]
        self.assertEqual(self.activite._demandeMouvement(rankor),
                         (['A2', 'A3', 'A4',
                           'B1', 'B2', 'B3',
                           'C1', 'C2', 'D1'],
                          "marque_choixPossible") )
        
    def test_casePossible(self):
        self.assertEqual(self.activite._casePossible(
                             3,
                             "C3"),
                         ['C4', 'C2', 'C5', 'C1', 'C6',
                          'D3', 'B3', 'D4', 'D2', 'B4', 'B2',
                          'D5', 'D1', 'B5', 'B1', 'E3', 'A3',
                          'E4', 'E2', 'A4', 'A2', 'F3' ] )


if __name__ == "__main__":
    #import sys;sys.argv = ['', 'Test.testInit']
    unittest.main()
    